<template>
  <div>
    <label>
      地址定位：
      <input v-model="keyword">
    </label>
    <baidu-map>
      <bm-view class="map"></bm-view>
      <bm-local-search
        :keyword="keyword"
        :auto-viewport="true"
        @markersset="markersset"
        @infohtmlset="infohtmlset"
        @resultshtmlset="resultshtmlset"
        @searchcomplete="searchcomplete"
        :location="location"
      ></bm-local-search>
    </baidu-map>
  </div>
</template>

<script>
export default {
  data() {
    return {
      location: '深圳',
      keyword: '深圳'
    }
  },
  methods: {
    infohtmlset(b) {
      this.keyword = b.address
      console.log('b', b)
    },
    resultshtmlset(c) {
      console.log('c', c)
    },
    searchcomplete(d) {
      console.log('d', d)
    },
    markersset(a) {
      console.log('a', a)
    }
  }
}
</script>
<style lang="scss">
.map {
  height: 400px;
  width: 100%;
}
</style>